﻿;$(function(p){
	/// <param name="p">Placeholder for <c>window.performance</c>.</param>

	p = window.performance;
	if (!p){ return; }
	
	function check(d,$l,f,t){
		/// <param name="d">Dictionary object to check.</param>
		/// <param name="$l">jQuery reference to the current list item.</param>
		/// <param name="f">Function used to format the output.</param>
		/// <param name="t">Placeholder for the inner text of the list item.</param>

		t = $l.text();
		if(t in d){ $l.append(' &ndash; ' + (f ? f(d[t]) : d[t])); }
	}
	
	!!p.navigation && $('#perfint-perf>#perfint-perf-navigation>li').each(function(i,t){
		check(p.navigation, $(t));
	});

	!!p.timing && $('#perfint-perf>#perfint-perf-timing>li').each(function(i,t) {
		check(p.timing, $(t), function(v){ return new Date(v); });
	});

});